package hn.sigit.model.hnd.administrative;

import hn.sigit.model.hnd.cadastre.HND_Parcel;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="HND_BuildingPermit", schema="hnd_administrative")
@Inheritance(strategy=InheritanceType.JOINED)
public class HND_BuildingPermit extends HND_Permit implements Serializable {
	private static final long serialVersionUID = -2848708138378243186L;
	
	private HND_BuildingPermitType type;
	private String fieldVisitObs;
	private String environmentalConditionsObs;
	
	private HND_Parcel selectedParcel;

	
	@Column(name="Type", nullable=true)
	@Enumerated(EnumType.STRING)
	public HND_BuildingPermitType getType() {
		return type;
	}
	public void setType(HND_BuildingPermitType type) {
		this.type = type;
	}
	
	@Column(name="FieldVisitObs", nullable=true)
	public String getFieldVisitObs() {
		return fieldVisitObs;
	}
	public void setFieldVisitObs(String fieldVisitObs) {
		this.fieldVisitObs = fieldVisitObs;
	}
	
	@Column(name="EnvironmentalConditionsObs", nullable=true)
	public String getEnvironmentalConditionsObs() {
		return environmentalConditionsObs;
	}
	public void setEnvironmentalConditionsObs(String environmentalConditionsObs) {
		this.environmentalConditionsObs = environmentalConditionsObs;
	}
	
	@ManyToOne(targetEntity=HND_Parcel.class, optional=false, fetch=FetchType.LAZY)
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})
	@JoinColumns({ @JoinColumn(name="SelectedParcelID", referencedColumnName="hnd_spatialzoneid") })
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)
	public HND_Parcel getSelectedParcel() {
		return selectedParcel;
	}
	public void setSelectedParcel(HND_Parcel selectedParcel) {
		this.selectedParcel = selectedParcel;
	}
}
